package com.spring.springaop.acpect;


import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Slf4j
//@Component
@Aspect
@Order(2)
public class AspectDemo {
    @Pointcut("execution(* com.spring.springaop.controller.*.*(..))")
    public void pt(){}
    @Before("pt()")
    public void dobefore() {
        log.info("before");
    }
    @After("pt()")
    public void doafter() {
        log.info("after");
    }
//    @AfterReturning("pt()")
//    public void doAfterReturning() {
//        log.info("doAfterReturning");
//    }
//    @AfterThrowing("pt()")
//    public void doAfterThrowing() {
//        log.info("AfterThrowing");
//    }
//    @Around("pt()")
//    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
//        log.info("Around前");
//        Object o = pjp.proceed();
//        log.info("Around后");
//        return o;
//    }
}
